package database.service;

import database.DAO.UserDAO;
import common.User;

public class UserService {
    private UserDAO userDAO=new UserDAO();
    private Class<User> userClass=User.class;

    public User queryByAccount(String account){
        return userDAO.queryBean(
                "select * from `user` where user_account=?",
                userClass,account
        );
    }
    public User queryByUserName(String userName){
        return userDAO.queryBean(
                "select * from `user` where user_name=?",
                userClass,userName
        );
    }
    public Long queryIdByUserName(String userName){
        return (Long) userDAO.queryScalar(
                "select id from `user` where user_name=?",userName
        );
    }
}
